﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;

namespace PartyInvites.Test.Chart4
{
    public class MyAsyncMethod
    {
        public static async Task<long?> GetPageLengthAsync()
        {
            HttpClient client = new HttpClient();
            //var httpTask =  client.GetAsync("http://apress.com");
            //return httpTask.ContinueWith((Task<HttpResponseMessage> antecedent) =>
            //{
            //    return antecedent.Result.Content.Headers.ContentLength;
            //});


            var httpTask = await client.GetAsync("http://apress.com");
            return httpTask.Content.Headers.ContentLength;
        }
    }
}